﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Management/Management.master" AutoEventWireup="true"
    CodeFile="ArticleManager.aspx.cs" Inherits="Management_ArticleManager" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table>
        <tr>
            <td>
                <asp:DropDownList ID="ddl_Category" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                    DataTextField="Name" DataValueField="ID" OnSelectedIndexChanged="ddl_Category_SelectedIndexChanged">
                </asp:DropDownList>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AvatarConnectionString %>"
                    SelectCommand="SELECT [ID], [Name] FROM [NewsCategory]"></asp:SqlDataSource>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
                    ForeColor="#333333" GridLines="None" AllowPaging="True" DataSourceID="SqlDataSource2"
                    EmptyDataText="该分类下不包含任何新闻内容">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField HeaderText="文章标题">
                            <ItemTemplate>
                                <a href="#">
                                    <%# Eval("Title") %></a>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="发布日期">
                            <ItemTemplate>
                                <%# Eval("PublishDate") %>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="操作">
                            <ItemTemplate>
                                <asp:Button ID="btn_Edit" runat="server" Text="编辑" OnClick="btn_Edit_Click" CommandArgument='<%# Eval("ID") %>' />
                                <asp:Button ID="btn_Delete" runat="server" Text="删除" OnClick="btn_Delete_Click" CommandArgument='<%# Eval("ID") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:AvatarConnectionString %>"
                    SelectCommand="SELECT [ID], [Title], [Content], [PublishDate], [CategoryID], [Hits] FROM [News] WHERE ([CategoryID] = @CategoryID)">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddl_Category" Name="CategoryID" PropertyName="SelectedValue"
                            Type="Int32" />
                    </SelectParameters>
                </asp:SqlDataSource>
                <div class="Dialog">
                    <div class="Title">
                        编辑新闻内容
                    </div>
                    <div class="Content">
                        <table>
                            <tr>
                                <td>
                                    分类：
                                </td>
                                <td>
                                    <asp:DropDownList ID="ddl_NewsCategory2" runat="server" DataSourceID="SqlDataSource1"
                                        DataTextField="Name" DataValueField="ID">
                                    </asp:DropDownList>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    标题：
                                </td>
                                <td>
                                    <asp:TextBox Width="300px" ID="txt_Title" runat="server"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    内容
                                </td>
                                <td>
                                    <FCKeditorV2:FCKeditor ID="txt_Content" runat="server">
                                    </FCKeditorV2:FCKeditor>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:Button ID="btn_Edit" runat="server" Text="编辑" CssClass="Button" OnClick="btn_Add_Click" />
                                    <asp:HiddenField ID="txt_ID" runat="server" />
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
                <asp:Label ID="lbl_Error" runat="server" EnableViewState="false" ForeColor="Red"></asp:Label>
            </td>
        </tr>
    </table>
</asp:Content>
